package swg.shape;

import java.util.ArrayList;
import java.util.HashMap;

public class Tree implements IswgShape 
{
	protected Branch start;
	protected HashMap<Integer, ArrayList<Branch>> branches = new HashMap<Integer, ArrayList<Branch>>();
	protected int level = 0;
	protected int lengh = 0;
	protected Color styleColor;
	protected int styleStrike = 0;
	protected boolean caps;
	protected int styleCapsRadius;
	protected Color styleCapsColor;

	public void setTxt(String txt){
		start.setTxt(txt);
	}
	
	public Tree(Branch trunk)
	{
		this.start=trunk;
	}

	public double getPhi()
	{
		return start.getZero().getPhi();
	}

	public double getRho()
	{
		return start.getZero().getRho();
	}
	
	public Branch getStart()
	{
		return start;
	}
	public void setStart(Branch start)
	{
		this.start = start;
	}
	public HashMap<Integer, ArrayList<Branch>> getBranches()
	{
		return branches;
	}
	public void setBranches(HashMap<Integer, ArrayList<Branch>> branches)
	{
		this.branches = branches;
	}
	public int getLevel()
	{
		return level;
	}
	public void setLevel(int level)
	{
		this.level = level;
	}
	public int getLengh()
	{
		return lengh;
	}
	public void setLengh(int lengh)
	{
		this.lengh = lengh;
	}
	public Color getStyleColor()
	{
		return styleColor;
	}
	public void setStyleColor(Color styleColor)
	{
		this.styleColor = styleColor;
	}
	public int getStyleStrike()
	{
		return styleStrike;
	}
	public void setStyleStrike(int styleStrike)
	{
		this.styleStrike = styleStrike;
	}
	public boolean isCaps()
	{
		return caps;
	}
	public void setCaps(boolean caps)
	{
		this.caps = caps;
	}
	public int getStyleCapsRadius()
	{
		return styleCapsRadius;
	}
	public void setStyleCapsRadius(int styleCapsRadius)
	{
		this.styleCapsRadius = styleCapsRadius;
	}
	public Color getStyleCapsColor()
	{
		return styleCapsColor;
	}
	public void setStyleCapsColor(Color styleCapsColor)
	{
		this.styleCapsColor = styleCapsColor;
	}

	@Override
	public int getR()
	{
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String getSWGCode()
	{
		StringBuffer svg= new StringBuffer(start.getSWGCode());
		
		for(Integer level: branches.keySet()){
			ArrayList<Branch> arrayBranches = branches.get(level);
			for(Branch b : arrayBranches){
				svg.append(b.getSWGCode());
			}
		}
		return svg.toString();
	}

	@Override
	public int getX()
	{
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int getY()
	{
		// TODO Auto-generated method stub
		return 0;
	}
	
	
	
}
